package vy.org.app.page.santsamaj;

import org.vy.dal.dao.VySantSamajDO;
import vy.org.util.DateUtil;

public class MntnSantSamajAssembler {

	private static MntnSantSamajAssembler assembler = new MntnSantSamajAssembler();

	public static MntnSantSamajAssembler getAssembler() {
		return assembler;
	}

	public VySantSamajDO getSantSamajDO(MntnSantSamajForm form) {
		VySantSamajDO dto = new VySantSamajDO();

		if (form.getSantSamajId() != null
				&& !"".equals(form.getSantSamajId().trim())) {
			dto.setSantSamajId(form.getSantSamajId());
		}
		if (form.getSantSamajName() != null
				&& !"".equals(form.getSantSamajName().trim())) {
			dto.setSantSamajName(form.getSantSamajName());
		}
		if (form.getEmail() != null && !"".equals(form.getEmail().trim())) {
			dto.setEmail(form.getEmail());
		}
		if (form.getAddressId() != null
				&& !"".equals(form.getAddressId().trim())) {
			dto.setAddress(Integer.parseInt(form.getAddressId()));
		}
		if (form.getContactNo() != null
				&& !"".equals(form.getContactNo().trim())) {
			dto.setContactNum(form.getContactNo());
		}
		if (form.getFax() != null && !"".equals(form.getFax().trim())) {
			dto.setFax(form.getFax());
		}
		if (form.getContactId1() != null
				&& !"".equals(form.getContactId1().trim())) {
			dto.setContactVyid1(form.getContactId1());
		}
		if (form.getContactId2() != null
				&& !"".equals(form.getContactId2().trim())) {
			dto.setContactVyid2(form.getContactId2());
		}
		if (form.getComment() != null && !"".equals(form.getComment().trim())) {
			dto.setComment(form.getComment());
		}
		if (form.getLastUpdatedBy() != null
				&& !"".equals(form.getLastUpdatedBy().trim())) {
			dto.setLastUpdatedBy(form.getLastUpdatedBy());
		}
		if (form.getLastUpdatedOn() != null
				&& !"".equals(form.getLastUpdatedOn().trim())) {
			dto
					.setLastUpdatedOn(DateUtil.standardDate(form
							.getLastUpdatedOn()));
		}
		return dto;

	}

}
